<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<style>
    /*重新设置样式*/
    .form-control {
        width: 196px !important;
        height: 34px !important;
        padding: 10px !important;
    }
</style>
<body class="hold-transition skin-blue sidebar-mini" onload="checkBrowser()">
<div class="modal fade" id="modal-create-adj">
    <div class="modal-dialog" style="width:80%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">新增库存调整</h4>
            </div>
            <div class="modal-body">
                <form id="inveAdjCreateForm" class="form-horizontal">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">物料描述</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjMatDesc" placeholder="请输入物料描述">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">SAP物料编码</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjMatCode" placeholder="请输入编码">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="col-md-12">

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">在库数量</label>
                                    <div class="col-sm-8">
                                        <input type="value" class="form-control" name="adjNum" placeholder="请输入在库数量">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">单位</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjUnit" placeholder="请输入单位">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">单价（元）</label>
                                    <div class="col-sm-8">
                                        <input type="value" class="form-control" name="adjPrice" placeholder="请输入单价">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">金额（元）</label>
                                    <div class="col-sm-8">
                                        <input type="value" class="form-control" name="adjAmount" placeholder="请输入金额">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="col-md-12">

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">项目编号</label>
                                    <div class="col-sm-8">
                                        <input type="text"
                                               class="form-control"
                                               name="adjProCode"
                                               placeholder="请输入项目编号"
                                               onchange="changeCeoNeedProName()"
                                               oninput="findProCodeListData(this)"
                                               list="codeList">
                                        <datalist id="codeList">
                                        </datalist>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">项目名称</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjProName" placeholder="请输入项目名称">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">跟踪号</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjTrackCode"
                                               placeholder="请输入跟踪号">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">在库类型</label>
                                    <div class="col-sm-8">
                                        <select name="adjStockType"
                                                style="padding: 0px!important;text-align: center!important;text-align-last: center!important;"
                                                class="form-control">
                                            <option value="" selected="selected">请选择在库类型</option>
                                            <option value=1>库存在库</option>
                                            <option value=2>项目在库</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">备注</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjSpec" placeholder="请输入备注">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">记账日期</label>
                                    <div class="col-sm-8">
                                        <input type="text" id="rangeDate" class="form-control datepicker" readonly="readonly" name="adjBookkeepingDate"
                                               placeholder="请输入记账日期">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">区位</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjPosition" placeholder="请输入区位">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">仓库</label>
                                    <div class="col-sm-8">
                                        <select name="adjWhiId"
                                                style="padding: 0px!important;text-align: center!important;text-align-last: center!important;width: auto!important;"
                                                class="form-control">
                                            <option value="" selected="selected">请选择仓库</option>
                                            <option th:each="whiIds:${whiIds}" th:value="${whiIds.whiId}"
                                                    th:text="${whiIds.whiName}"></option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-12">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">机械备件库备注类型</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjRemarkType" placeholder="请输入机械备件库备注类型">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">调整原因</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjReason" placeholder="请输入调整原因">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
                </form>
                <div class="modal-footer">
                    <button type="button" class="btn btn-info" id="btn-creat-save"
                            shiro:hasPermission="purinv:puradjlist:edit">保存
                    </button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="modal-edit-adj">
    <div class="modal-dialog" style="width:80%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">库存调整</h4>
            </div>
            <div class="modal-body">
                <form id="inveForm" class="form-horizontal">
                    <input type="hidden" id="ityId" name="ityId">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">物料描述</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="ityMatDesc" id="ityMatName"
                                           placeholder="">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">在库数量</label>
                                <div class="col-sm-8">
                                    <input type="value" class="form-control" name="ityNum" placeholder="">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">单价（元）</label>
                                <div class="col-sm-8">
                                    <input type="value" class="form-control" name="ityPrice" placeholder="">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">单位</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="ityNumUnit" placeholder="">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">品牌</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="ityBrand" placeholder=""
                                           readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">SAP物料编码</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="itySapCode" placeholder=""
                                           readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">项目编号</label>
                                <div class="col-sm-8">
                                    <input type="text"
                                           class="form-control"
                                           name="ityProCode"
                                           placeholder=""
                                           readonly="readonly"
                                    />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">项目名称</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="ityProName" placeholder=""
                                           readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">仓库</label>
                                <div class="col-sm-3">
                                    <select name="ityWhiId" class="form-control" readonly="readonly"
                                            onmousedown="javascript:return false;"
                                            style="padding: 0px!important;text-align: center!important;text-align-last: center!important;width: auto!important;">
                                        <option value="" selected="selected">全部</option>
                                        <option th:each="whiIds:${whiIds}" th:value="${whiIds.whiId}"
                                                th:text="${whiIds.whiName}"></option>
                                    </select>
                                </div>
                                <label class="col-sm-2 control-label"
                                       >区位</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" name="ityPosition" placeholder=""
                                           style="width:100px!important;"
                                           readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">跟踪号</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="ityTrackCode" placeholder=""
                                           readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">在库类型</label>
                                <div class="col-sm-8">
                                    <select name="ityStockType" class="form-control" readonly="readonly"
                                            onmousedown="javascript:return false;"
                                            style="padding: 0px!important;text-align: center!important;text-align-last: center!important;width: auto!important;">
                                        <option value="1">库存在库</option>
                                        <option value="2">项目在库</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">备注</label>
                                <div class="col-sm-8">
                                    <input readonly="readonly" type="text" class="form-control" name="ityRemark"
                                           placeholder="">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">机械备件库备注类型</label>
                                    <div class="col-sm-8">
                                        <input type="text" readonly="readonly" class="form-control" name="ityRemarkType" placeholder="">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">调整原因</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="adjReason" placeholder="">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="btn-inve-adj"
                        shiro:hasPermission="purinv:puradjlist:edit">保存
                </button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>

<section class="content-header">
    <h1 style="display: inline-block" id="title">库存列表</h1>
    <button onclick="javascript:window.history.back();" type="button" class="btn btn-success"
            style="text-align:center;vertical-align:middle;font-size:30px;position:absolute;right:3%;display: inline-block;background-color: transparent;border: none;color: #5c5c5c;outline:none;">
        <i style="-moz-transform:scaleX(-1);-webkit-transform:scaleX(-1);-o-transform:scaleX(-1);transform:scaleX(-1);filter:FlipH;"
           class="glyphicon glyphicon-share-alt"></i><span
            style="margin-left: 5px;font-size: 16px;position: absolute;top: 20%;">返回</span>
    </button>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm">
                        <div class="row">
                            <div class="form-inline">

                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label>项目名称</label>
                                    <input type="text"
                                           name="ityProName"
                                           class="form-control"
                                           placeholder="请输入项目名称" style="width:150px"/>
                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label>项目编号</label>
                                    <input type="text" name="ityProCode" class="form-control" placeholder="请输入项目编号">
                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label>物料描述</label>
                                    <input type="text" name="ityMatDesc" class="form-control" placeholder="请输入物料描述">
                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label>SAP物料编号</label>
                                    <input type="text" name="itySapCode" class="form-control" placeholder="请输入物料描述">
                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label>跟踪号</label>
                                    <input type="text" name="ityTrackCode" class="form-control" placeholder="请输入项目编号">
                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label>仓库</label>
                                    <select name="ityWhiId"
                                            style="padding: 0px!important;text-align: center!important;text-align-last: center!important;width: auto!important;"
                                            class="form-control" >
                                        <option value="" selected="selected">全部</option>
                                        <option th:each="whiIds:${whiIds}" th:value="${whiIds.whiId}"
                                                th:text="${whiIds.whiName}"></option>
                                    </select>
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search">
                                    <span class="Bold">&emsp;搜索&emsp;</span>
                                </button>

                            </div>
                        </div>
                    </form>
                </div>
                <div class="row" id="toolbar">
                    <a class="btn btn-info pull-right" onclick="createInveAdj()"
                       shiro:hasPermission="purinv:puradjlist:edit">
                        <span class="Bold">新增库存调整</span>
                    </a>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>

<div th:include="include :: footer"></div>
<script th:inline="javascript">


    function checkBrowserFun() {
        let is360 = false;
        let isIE = false;
        let isFirefox = false;
        let isChrome = false;
        let isEdge = false;
        let broName = 'Runing';
        let str = '';
        let strStart = 0;
        let strStop = 0;
        let arr = new Array();
        let temp = '';
        let userAgent = window.navigator.userAgent; //包含以下属性中所有或一部分的字符串：appCodeName,appName,appVersion,language,platform
        /*alert(userAgent);*/
        //FireFox
        if (userAgent.indexOf('Firefox') != -1) {
            isFireFox = true;
            /*broName = 'FireFox浏览器';*/
            strStart = userAgent.indexOf('Firefox');
            temp = userAgent.substring(strStart);
            broName = temp.replace('/', '版本号')

        }
        //Edge
        if (userAgent.indexOf('Edge') != -1) {
            isEdge = true;
            /*broName = 'Edge浏览器';*/
            strStart = userAgent.indexOf('Edge');
            temp = userAgent.substring(strStart);
            broName = temp.replace('/', '版本号');
        }
        //IE浏览器
        if (userAgent.indexOf('NET') != -1 && userAgent.indexOf("rv") != -1) {
            isIE = true;
            /*broName = 'IE浏览器'; */
            strStart = userAgent.indexOf('rv');
            strStop = userAgent.indexOf(')');
            temp = userAgent.substring(strStart, strStop);
            broName = temp.replace('rv', 'IE').replace(':', '版本号');
        }
        //360极速模式可以区分360安全浏览器和360极速浏览器
        if (userAgent.indexOf('WOW') != -1 && userAgent.indexOf("NET") < 0 && userAgent.indexOf("Firefox") < 0) {
            if (navigator.javaEnabled()) {
                is360 = true;
                broName = '360安全浏览器-极速模式';
            } else {
                is360 = true;
                broName = '360极速浏览器-极速模式';
            }
        }
        //360兼容
        if (userAgent.indexOf('WOW') != -1 && userAgent.indexOf("NET") != -1 && userAgent.indexOf("MSIE") != -1 && userAgent.indexOf("rv") < 0) {
            is360 = true;
            broName = '360兼容模式';
        }
        //Chrome浏览器
        if (userAgent.indexOf('WOW') < 0 && userAgent.indexOf('Chrome') > 0 && userAgent.indexOf("Edg") < 0) {
            isChrome = true;
            /*broName = 'Chrome浏览器';*/
            strStart = userAgent.indexOf('Chrome');
            strStop = userAgent.indexOf(' Safari');
            temp = userAgent.substring(strStart, strStop);
            broName = temp.replace('/', '版本号');
        }
        return isChrome;
    }

    /**
     * 检测浏览器
     * */
    function checkBrowser(){
        if(!checkBrowserFun()){
            js.modal.warning("尊敬的客户，您使用浏览器不是谷歌浏览器，请使用谷歌浏览器访问本系统！");
            location.href=ctx+"overview/index";
        }
    }

    /**
     *@FunctionName: findProCodeListData
     *@Description: 根据项目号模糊查询获取项目号列表
     *@Author: 徐一贺
     *@CreateDate: 2020/4/18 12:59
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    function findProCodeListData(obj) {
        $.post(ctx + 'purchase/change/findProCodeList', {
            code: $(obj).val()
        }, function (result) {
            if (result.type == 'SUCCESS') {
                $("#codeList").empty();
                for (var i = 0; i < result.data.length; i++) {
                    $("#codeList").append('<option value="' + result.data[i].code + '" data="' + result.data[i].name + '" data-status="' + result.data[i].status + '"></option>');
                }
            }
        }, 'json');
    }

    function changeCeoNeedProName() {
        var input_select = $("#inveAdjCreateForm [name='adjProCode']").val();
        var option_length = $("#codeList").find("option").length;
        for (var i = 0; i < option_length; i++) {
            if (input_select == $("#codeList option").eq(i).attr('value')) {
                $("#inveAdjCreateForm [name='adjProName']").val($("#codeList option").eq(i).attr("data"));
                break;
            }
        }
    }



    /**
     * 打开调整模态框
     */
    function openEditAdj(ityId) {
        js.post({
            url: ctx + "purchase/adjust/apply/getInventory",
            data: {
                ityId: ityId
            },
            success: function (result) {
                $("#inveForm").fillData(result.data);
                js.modal.open("modal-edit-adj");
                js.modal.closeLoading();
            }
        })
    }

    /**
     * 打开新增库存调整模态框
     */
    function createInveAdj() {
        js.modal.open("modal-create-adj");
    }

    var table, backType;
    $(function () {
        $("title").html($("title").html()+" —— 新增库存调整");
        /**
         * 加载列表
         */
        table = js.table.init({
            url: ctx + "purchase/adjust/apply/invList",
            onLoadSuccess: function (){
                $('#btn-search').prop('disabled', false).removeClass('disabled');
            },
            columns: [
                {
                    title: '序号', field: 'ityId', width: '50',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                {title: '物料描述', field: 'ityMatDesc', width: '200'},
                {title: 'SAP物料编码', field: 'itySapCode'},
                {title: '数量', field: 'ityNum', width: '80'},
                {title: '单位', field: 'ityNumUnit', width: '50'},
                {
                    title: '单价</br>（元）', field: 'ityPrice', width: '80',
                    formatter: function (value, row, index) {
                        if (hasP('purinv:amount:view')) {
                            if(value==undefined || value == null){
                                return "--";
                            }
                            return value;
                        }
                        return '***';
                    }
                },
                {title: '项目编号', field: 'ityProCode', width: '150', formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }},
                {title: '项目名称', field: 'ityProName', width: '150', formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }},
                {title: '跟踪号', field: 'ityTrackCode', width: '150'},
                {title: '备注', field: 'ityRemark', width: '150'},
                {title: '仓库', field: 'whiName', width: '150'},
                {title: '区位', field: 'ityPosition', width: '150'},
                {title: '记账日期', field: 'ityBookkeepingDate', width: '100'},
                {
                    title: '操作', width: '90',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (hasP("purinv:puradjlist:edit")) {
                            actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="openEditAdj(' + row.ityId + ')"> 调整</a> ');
                        }
                        return actions.join('');
                    }
                }
            ]
        });

        /**
         * 保存变更库存
         */
        $("#btn-inve-adj").click(function () {
            js.submit({
                url: ctx + "purchase/adjust/apply/create",
                data:
                    new FormData($("#inveForm")[0]),
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table);
                        js.modal.hide("modal-edit-adj");
                    } else {
                        js.modal.warning(result.msg);
                    }
                    js.modal.closeLoading();
                }
            });
        });

        /**
         * 保存新增库存调整
         */
        $("#btn-creat-save").click(function () {
            js.validSubmit({
                formId: "inveAdjCreateForm",
                url: ctx + "purchase/adjust/apply/create",
                data:
                    new FormData($("#inveAdjCreateForm")[0]),
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table);
                        js.modal.hide("modal-create-adj");
                    } else {
                        js.modal.warning(result.msg);
                    }
                    js.modal.closeLoading();
                }
            });
        });
        /** 验证 */
        js.validate.init("inveAdjCreateForm", {
            fields: {
                adjNum: {
                    validators:
                        {
                            notEmpty: {message: '请输入在库数量'},
                            digits: {message: '请输入数值'}
                        }
                },
                adjPrice: {validators: {notEmpty: {message: '请输入单价'}, digits: {message: '请输入数值'}}},
                adjMatDesc: {validators: {notEmpty: {message: '未输入物料描述'}}},
                adjStockType: {validators: {notEmpty: {message: '未选择在库类型'}}},
                adjUnit: {validators: {notEmpty: {message: '未输入单位'}}},
                adjWhiId: {validators: {notEmpty: {message: '未选择仓库'}}},
                adjProCode: {
                    validators: {
                        threshold: 6, //有6字符以上才发送ajax请求，（input中输入一个字符，插件会向服务器发送一次，设置限制，6字符以上才开始）
                        callback: {
                            message: "项目号不存在",
                            callback: function (value, validator) {
                                var flag = false;
                                $.ajax({
                                    url: ctx + 'purchase/change/codeExist', // 请求路径
                                    type: 'POST',
                                    async: false,	// 同步请求，必须是false
                                    data: {
                                        ceoNeedProCode: $("#inveAdjCreateForm input[name='adjProCode']").val() // 请求参数
                                    },
                                    success: function (res) {
                                        flag = $.parseJSON(res).valid;
                                    }
                                });
                                return flag;
                            }
                        }
                    }
                }
            }
        });

        /**
         * 表格搜索
         */
        $("#btn-search").click(function () {
            $('#btn-search').prop('disabled', true).addClass('disabled');
            js.table.search(table);
        });

        /**
         * 模态框隐藏事件， 重置表单，重置验证
         */
        js.modal.hideEvent("modal-create-adj", function () {
            js.validate.reset("inveAdjCreateForm");
            js.reset("inveAdjCreateForm");
        })
    });
</script>
</body>
</html>